import Taro from '@tarojs/taro';
import { getGlobalData, setGlobalData } from '@UTILS/globalData'
import DBConfig from '@CONFIG/DBConfig'

const INTERNAL_ACCOUNT = {
  3128523569: 1,
  15221479163: 1,
  13028141202: 1,
  18668203025: 1,
  15700156949: 1,
  18217779245: 1,
  13588394115: 1,
  15394216967: 1,
  13001001015: 1,
  18225602669: 1,
  15068712898: 1,
  15968145035: 1,
  13588235133: 1,
  13506816469: 1,
  18629362624: 1,
  15068139544: 1,
  13634170498: 1,
  18516983426: 1,
  13282218817: 1,
  13758230416: 1,
  13590400645: 1,
  18535491466: 1,
  18435204551: 1,
  18268125566: 1,
  18768108286: 1,
  15868197630: 1,
  17855871850: 1,
  15267012184: 1,
  18161805899: 1,
  15595894095: 1,
  18236593093: 1,
  18609490269: 1,
  17669656062: 1,
  18329002731: 1,
  15356172057: 1,
  13646869580: 1,
  13610884166: 1
}

export const initUserAccount = async () => {
  const { UserName } = await Taro.getStorageSync('user')
  setGlobalData('userAccount', UserName)
}

export const isInternalAccount = async () => {
  if (DBConfig.careEnvType !== 'prod') {
    return false
  }
  let userName = getGlobalData('userAccount')
  if (!userName) {
    await initUserAccount()
    userName = getGlobalData('userAccount')
  }
  return INTERNAL_ACCOUNT[userName]
}
